import sys, os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))

from threading import Thread, Lock

class LeechStrategyInterface(Thread):
    def __init__(self, brook):
        self._brook = brook
        #needed for thread stopping
        self._shutdown = False
        self._shutdown_signal = Lock()
        
    def run(self):
        with self._shutdown_signal:
            while not self._shutdown:
                pass
    
    def shutdown(self, block = True):
        self._shutdown = True
        if block:
            self._shutdown_signal.acquire()
            self._shutdown_signal.release()